package handling.opcode;

import handling.ExternalCodeTableGetter;
import handling.WritableIntValueHolder;

import java.io.*;
import java.util.Properties;

public enum SendPacketOpcode implements WritableIntValueHolder {

    LOGIN_STATUS(0x0),
    SERVERLIST(0x1),
    ENABLE_RECOMMENDED(0x3),
    CHARLIST(0x6),
    SERVER_IP(0x7),
    AUTO_LOGIN_STATUS(0x8),
    CHAR_NAME_RESPONSE(0xa),
    ADD_NEW_CHAR_ENTRY(0xb),
    DELETE_CHAR_RESPONSE(0xc),
    CHANGE_CHANNEL(0x10),
    PING(0x11),
    CLIENT_AUTH(0x16),
    CS_USE(0xc),
    EVENT_CHECK(0xd),
    GUILD_CHAT(0x12),
    BUDDY_CHAT(0x13),
    PART_TIME(0x1e),
    CREATING_CONNECTION(0x27),
    OPCODE_ENCRYPTION(0x28),
    LICENSE_RESULT(0x32),
    CHOOSE_GENDER(0x36),
    GENDER_SET(0x37),
    UNK0007(0x35),
    UNK0008(0x36),
    SHOW_CHAR_CARDS(0x3a),
    SHOW_ACC_CASH(0x3b),
    SHOW_CHARSOLE(0x3c),
    WZ_CHECK(0x3f),
    SERVERSTATUS(0x45),
    CHANNEL_SELECTED(0x7ffe),
    RSA_KEY(0x3d),
    LOGIN_AUTH(0x46),
    CREAT_CHAR_AUTH(0x7ffe),
    SET_VIP_CHANNEL(0x4c),
    LOGIN_WELCOME(0x4d),
    SEND_RECOMMENDED(0x7ffe),
    SECONDPW_ERROR(0x7ffe),
    MODIFY_INVENTORY_ITEM(0x5f),
    UPDATE_INVENTORY_SLOT(0x60),
    UPDATE_STATS(0x61),
    GIVE_BUFF(0x62),
    CANCEL_BUFF(0x63),
    TEMP_STATS(0x64),
    TEMP_STATS_RESET(0x65),
    UPDATE_SKILLS(0x66),
    UPDATE_SKILL_TICK(0x67),
    SKILL_MEMORY(0x6d),
    SKILL_USE_RESULT(0x6e),
    FAME_RESPONSE(0x70),
    SHOW_STATUS_INFO(0x71),
    SHOW_NOTES(0x72),
    TROCK_LOCATIONS(0x73),
    LIE_DETECTOR(0x74),
    REPORT_RESPONSE(0x78),
    ENABLE_REPORT(0x79),
    UPDATE_MOUNT(0x7b),
    SHOW_QUEST_COMPLETION(0x7c),
    SEND_TITLE_BOX(0x7d),
    USE_SKILL_BOOK(0x7e),
    SP_RESET(0x7f),
    AP_RESET(0x80),
    DISTRIBUTE_ITEM(0x7ffe),
    EXPAND_CHARACTER_SLOTS(0x7ffe),
    FINISH_GATHER(0x84),
    FINISH_SORT(0x85),
    REPORT_RESULT(0x7ffe),
    TRADE_LIMIT(0x7ffe),
    UPDATE_GENDER(0x7ffe),
    CHAR_INFO(0x88),
    PARTY_OPERATION(0x89),
    MEMBER_SEARCH(0x8a),
    PARTY_SEARCH(0x8c),
    EXPEDITION_OPERATION(0x91),
    BUDDYLIST(0x92),
    GUILD_OPERATION(0x95),
    ALLIANCE_OPERATION(0x96),
    SPAWN_PORTAL(0x97),
    MECH_PORTAL(0x7ffe),
    SERVERMESSAGE(0x98),
    PIGMI_REWARD(0x99),
    OWL_OF_MINERVA(0x9b),
    YELLOW_CHAT(0x9c),
    ENGAGE_REQUEST(0x9d),
    ENGAGE_RESULT(0x9e),
    WEDDING_GIFT_RESULT(0x9f),
    MARRIED_PARTNER_MAP_TRANSFER(0xa0),
    PET_PICKUP_MSG(0xa3),
    PET_AUTO_EAT_MSG(0xa4),
    SYNTHESIZING_MSG(0xa5),
    SHOP_DISCOUNT(0xa8),
    PLAYER_NPC(0xaa),
    NPC_HIDE(0xac),
    HOURCHANGED(0xaf),
    FM_HIDE_MINIMAP(0xb0),
    ENERGY(0xb4),
    GHOST_POINT(0xb5),
    GHOST_STATUS(0xb6),
    FIELD_VALUE(0xb7),
    FAIRY_PEND_MSG(0xb8),
    LEVEL_UPDATE(0xb9),
    MARRIAGE_UPDATE(0xba),
    JOB_UPDATE(0xbb),
    PENDANT_SLOT(0xbc),
    FOLLOW_REQUEST(0xbd),
    TOP_MSG(0xbf),
    SCRIPT_PROGRESS_ITEM_MSG(0xc0),
    MID_MSG(0xc1),
    CLEAR_MID_MSG(0xc2),
    MAP_EFFECT_MSG(0xc3),
    SPECIAL_TOP_MSG(0xc4),
    MAPLE_ADMIN(0xc7),
    MAPLE_ADMIN_ERROR(0xc8),
    UPDATE_JAGUAR(0xc9),
    UPDATE_ZEROINFO(0xca),
    UPDATA_WP(0xcb),
    ULTIMATE_EXPLORER(0xcd),
    PAM_SONG(0xce),
    PROFESSION_INFO(0xcf),
    UPDATE_IMP_TIME(0xd0),
    ITEM_POT(0xd1),
    UPDATE_LINKSKILL_RESULT(0xd6),
    DELETE_LINKSKILL_RESULT(0xd7),
    SET_LINKSKILL_RESULT(0xd8),
    MULUNG_MESSAGE(0xdc),
    MULUNG_DOJO_RANKING(0xdd),
    EQUIPPED_SKILL(0xe1),
    FUNCKEY_SET_BY_SCRIPT(0xe4),
    UPDATE_INNER_SKILL(0xe5),
    UPDATE_INNER_STATS(0xe7),
    CONFIRM_CROSS_HUNTER(0xeb),
    WHITEADDITIONAL_CUBE_RESULT(0x107),
    BLACKY_CUBE_EFFECT(0x108),
    MEMORIAL_CUBE_RESULT(0x109),
    MEMORIAL_CUBE_MODIFIED(0x10a),
    DRESS_UP_INFO_MODIFIED(0x10b),
    SKILL_ACTIVE(0x10d),
    SKILL_NOT_ACTIVE(0x10e),
    LOGIN_AUTHKEY(0x10f),
    GUILD_SEARCH_RESULTS(0x114),
    SYSTEM_PROCESS_LIST(0x11a),
    COMPLETE_NPC_SPEECH_SUCCESS(0x11b),
    COMPLETE_SPECIAL_CHECK_SUCCESS(0x11c),
    AVATAR_MEGA_RESULT(0x11f),
    AVATAR_MEGA(0x120),
    AVATAR_MEGA_REMOVE(0x121),
    MAPLE_EVENT(0x122),
    LOVE_OPERATION(0x125),
    CANCEL_TITLE_EFFECT(0x126),
    PARTY_RANKING(0x144),
    BOSS_MESSAGE(0x148),
    ENCHANTING_OPERATION(0x14c),
    TOP_TOWER_RANK_RESULT(0x14d),
    HAIDI_RESULT(0x14f),
    GAME_EXIT(0x156),
    UPDATE_CORE_AURA(0x15f),
    TOADS_HAMMER_REQUEST_RESULT(0x17b),
    USE_TOWERCHAIR_SETTING_RESULT(0x182),
    VCORE_LIST_UPDATE(0x18d),
    VCORE_SKILLEXP_RESULT(0x18f),
    VCORE_ADD_PIECE_RESULT(0x190),
    VCORE_ADD_SKILL_RESULT(0x191),
    UPDATE_MAPLE_UNION(0x19e),
    POTION_POT_MSG(0x1ac),
    POTION_POT_UPDATE(0x1ae),
    CHARACTER_MODIFIED(0x1b6),
    OPEN_WEB(0x1ba),
    SEND_CLIPBOARD(0x1bb),
    CHAR_CASH(0x1bc),
    UNK00A6(0x7ffe),
    SHOW_PREDICT_CARD(0x1c3),
    BBS_OPERATION(0x1c4),
    FISHING_STORE(0x1ca),
    SHOW_PLAYER_CASH(0x1d4),
    PLAYER_CASH_UPDATE(0x1d5),
    SAVE_DAMSKIN(0x1dd),
    DELETE_DAMSKIN(0x1de),
    NIRVANA_POTENTIAL_RESULT(0x1e8),
    SKILL_MACRO(0x1eb),
    WARP_TO_MAP(0x1ec),
    MTS_OPEN(0x1ed),
    CS_CHAR(0x1ef),
    CS_OPEN(0x1f0),
    RESET_SCREEN(0x7ffe),
    MAP_BLOCKED(0x1f1),
    SERVER_BLOCKED(0x1f2),
    PARTY_BLOCKED(0x1f3),
    SHOW_EQUIP_EFFECT(0x1f4),
    MULTICHAT(0x1f5),
    FIELD_UNIVERSE_MESSAGE(0x1f6),
    WHISPER(0x1f7),
    BOSS_ENV(0x1f9),
    MAP_EFFECT(0x1fa),
    CASH_SONG(0x1fb),
    GM_EFFECT(0x1fc),
    OX_QUIZ(0x1fd),
    GMEVENT_INSTRUCTIONS(0x1fe),
    CLOCK(0x1ff),
    BOAT_EFF(0x201),
    BOAT_EFFECT(0x202),
    SET_QUEST_CLEAR(0x203),
    STOP_CLOCK(0x206),
    PYRAMID_UPDATE(0x209),
    PYRAMID_RESULT(0x20a),
    QUICK_SLOT(0x20b),
    MONSTER_NOTICE_MESSAGE(0x213),
    MONSTER_PHASE_CHANGE(0x214),
    MONSTER_ZONE_CHANGE(0x215),
    MOVE_PLATFORM(0x7ffe),
    PVP_INFO(0x7ffe),
    DIRECTION_STATUS(0x7ffe),
    IN_GAME_CUR_NODE_EVENT_END(0x218),
    FORCEATOM_CREATE(0x219),
    FORCETELEATOM_CREATE(0x21a),
    FORCEATOM_ACTION(0x21c),
    ACHIEVEMENT_RATIO(0x21d),
    QUICK_MOVE(0x21e),
    CREATE_OBTACLEATOM(0x21f),
    CLEAR_OBTACLEATOM(0x220),
    CHANGE_MOBZONESTATE_REQUEST(0x227),
    WATER_UP_PLATFORM(0x22d),
    PQ_EFFECT(0x239),
    ADD_WRECKAGE(0x242),
    DEL_WRECKAGE(0x243),
    SPAWN_PLAYER(0x251),
    REMOVE_PLAYER_FROM_MAP(0x252),
    CHATTEXT(0x253),
    CHALKBOARD(0x254),
    UPDATE_CHAR_BOX(0x255),
    SHOW_CONSUME_EFFECT(0x256),
    SHOW_SCROLL_EFFECT(0x257),
    SHOW_SOULSCROLL_EFFECT(0x258),
    SHOW_ENCHANTER_EFFECT(0x259),
    SHOW_MAGNIFYING_EFFECT(0x25b),
    SHOW_POTENTIAL_RESET(0x25c),
    SHOW_POTENTIAL_FINALPANEL(0x25e),
    SHOW_ADDITIONAL_RESET(0x25f),
    SHOW_ADDITIONAL_EFFECT(0x260),
    SHOW_FIREWORKS_EFFECT(0x7ffe),
    SHOW_REDCUBE_RESULT(0x263),
    SHOW_ADDITIONALCUBE_RESULT(0x264),
    TESLA_TRIANGLE(0x269),
    FOLLOW_EFFECT(0x26a),
    CRAFT_EFFECT(0x26c),
    CRAFT_COMPLETE(0x26d),
    HARVESTED(0x26f),
    SHOW_DAMAGE_SKIN(0x277),
    SHOW_DAMAGE_SKIN_PREMIUM(0x278),
    SOUL_MODE(0x279),
    CANCEL_CHAIR(0x27a),
    FAMILIAR_OPERATION(0x27b),
    SET_REAPEAT_ONETIMEACTION(0x283),
    SHOW_INGAMECUBE_RESULT(0x285),
    GIVE_KSPSYCHIC(0x289),
    ATTACK_KSPSYCHIC(0x28a),
    CANCEL_KSPSYCHIC(0x28b),
    GIVE_KSULTIMATE(0x28d),
    CANCEL_KSULTIMATE(0x28e),
    MESO_CHAIR_ADD_MESO(0x292),
    SHOW_SHININGMIRROR_CUBE_RESULT(0x29d),
    SHOW_NEBULITE_EFFECT(0x29e),
    PET_ADD_SKILL(0x29f),
    EFFECT_SWITCH(0x2a8),
    SPAWN_PET(0x2a9),
    MOVE_PET(0x2aa),
    PET_CHAT(0x2ab),
    PET_NAMECHANGE(0x2ac),
    PET_EXCEPTION_LIST(0x2ae),
    PET_COLOR_CHANGE(0x2af),
    PET_MODIFIED(0x2b0),
    SHOW_PET(0x2b2),
    PET_COMMAND(0x2b3),
    DRAGON_SPAWN(0x2b4),
    DRAGON_MOVE(0x2b5),
    DRAGON_REMOVE(0x2b7),
    ANDROID_SPAWN(0x2b8),
    ANDROID_MOVE(0x2b9),
    ANDROID_EMOTION(0x2ba),
    ANDROID_UPDATE(0x2bb),
    ANDROID_DEACTIVATED(0x2bc),
    SPAWN_LARGEWHITE(0x2bd),
    CHANGE_LITTLEWHITE(0x2bf),
    REMOVE_LARGEWHITE(0x2c2),
    MOVE_LITTLEWHITE(0x2c4),
    REMOVE_LITTLEWHITE(0x2c5),
    SPAWN_LITTLEWHITE(0x2c9),
    MOVE_PLAYER(0x2d0),
    CLOSE_RANGE_ATTACK(0x2d1),
    RANGED_ATTACK(0x2d2),
    MAGIC_ATTACK(0x2d3),
    ENERGY_ATTACK(0x2d4),
    SKILL_EFFECT(0x2d5),
    CANCEL_SKILL_EFFECT(0x2d7),
    DAMAGE_PLAYER(0x2d8),
    FACIAL_EXPRESSION(0x2d9),
    SHOW_ITEM_EFFECT(0x2db),
    SHOW_TITLE_EFFECT(0x2dc),
    SHOW_UNK_EFFECT(0x2de),
    SHOW_CHAIR(0x2e2),
    UPDATE_CHAR_LOOK(0x2e3),
    SHOW_FOREIGN_EFFECT(0x2e4),
    GIVE_FOREIGN_BUFF(0x2e5),
    CANCEL_FOREIGN_BUFF(0x2e6),
    UPDATE_PARTYMEMBER_HP(0x2e7),
    LOAD_GUILD_NAME(0x2e8),
    LOAD_GUILD_ICON(0x2e9),
    LOAD_TEAM(0x2ea),
    SHOW_HARVEST(0x2ec),
    PVP_HP(0x2eb),
    SHOW_DRAGON_FLY(0x2ed),
    UPDATE_ZERO_LOOK(0x2f2),
    REMOVE_ZERO_FROM_MAP(0x2f4),
    SHOW_SKILL_SKIN(0x306),
    SHOW_SPECIAL_ATTACK(0x309),
    USER_EMOTION_LOCAL(0x30a),
    SHOW_SPECIAL_EFFECT(0x30c),
    CURRENT_MAP_WARP(0x30d),
    MESOBAG_SUCCESS(0x30f),
    MESOBAG_FAILURE(0x310),
    UPDATE_QUEST_INFO(0x311),
    BUFF_BAR(0x312),
    PET_FLAG_CHANGE(0x313),
    PLAYER_HINT(0x314),
    OPEN_WINDOW(0x31a),
    REPAIR_WINDOW(0x31c),
    INTRO_LOCK(0x31d),
    INTRO_LOCK_MOVIE(0x31e),
    CYGNUS_INTRO_DISABLE_UI(0x31f),
    SUMMON_HINT(0x320),
    SUMMON_HINT_MSG(0x321),
    ARAN_COMBO(0x328),
    CRAFT_MESSAGE(0x32c),
    SPOUSE_MESSAGE(0x32d),
    ARAN_COMBO_RECHARGE(0x32f),
    USER_EXPLOSION_ATTACK(0x331),
    FOLLOW_MOVE(0x332),
    FOLLOW_MSG(0x333),
    EXPERT_EFFECT(0x334),
    CREATE_ULTIMATE(0x335),
    HARVEST_MESSAGE(0x336),
    RUNE_ACTION(0x337),
    OPEN_BAG(0x338),
    SET_GAGE_POINT(0x339),
    PVP_ICEGAGE(0x33a),
    DIRECTION_INFO(0x33b),
    REISSUE_MEDAL(0x33c),
    CRIT_STATUS(0x33d),
    PLAY_MOVIE(0x33f),
    SHOW_CARTE(0x342),
    LUMINOUS_COMBO(0x345),
    PROTECTION_GAIN(0x344),
    BOSS_HATRED(0x347),
    INDIVIDUAL_DEATH_COUNT_INFO(0x349),
    SWITCH_LUCKYMONEY(0x34f),
    CHAR_REQUEST(0x350),
    CANNON_PLATE(0x352),
    PLAYER_DEAD(0x354),
    AUTO_SITDOWN(0x359),
    EXTRA_ATTACK(0x35d),
    SKILL_FEED(0x373),
    RUNE_EFFECT(0x37b),
    SCREEN_SHAKE(0x38b),
    NPC_NOTICE(0x38c),
    PANTHER_ATTACK(0x38e),
    USER_BONUS_ATTACK_REQUEST(0x392),
    USER_RANDAREA_ATTACK_REQUEST(0x393),
    OPEN_PANTHER_ATTACK(0x394),
    COOLDOWN(0x395),
    SET_CARRY_REACTOR_INFO(0x396),
    ROYAL_GUARD_ATTACK(0x39f),
    KSULTIMATE_ATTACK(0x3a0),
    SHOW_FIREWALL(0x3a9),
    REGISTER_EXTRA_SKILL(0x3ad),
    DAMAGE_SKIN_SAVE_RESULT(0x3b0),
    CANNON_SKILL_RESULT(0x3b5),
    SHOW_SOMEONE_GIFT(0x3bb),
    UNSTABLE_MEMORY(0x3bc),
    LIFT_SKILL_ACTION(0x3bd),
    CHAIN_RAGE_ACTION(0x3c1),
    FISHING_CAUGHT(0x7ffe),
    VIEW_WORLDMAP(0x3ee),
    JIANQI_POINTS(0x3f5),
    OPEN_WEB_UI(0x40f),
    SPAWN_SUMMON(0x413),
    REMOVE_SUMMON(0x414),
    MOVE_SUMMON(0x415),
    SUMMON_ATTACK(0x416),
    SUMMON_SKILL(0x419),
    DAMAGE_SUMMON(0x41c),
    SUMMON_SKILL_LINK(0x420),
    SUMMON_BEHOLDER_REVENGE_ATTACK(0x423),
    SUMMON_CROSS_THE_STYX(0x424),
    SUMMON_FORCE_MOVE(0x426),
    SUMMON_CRYSTAL_EFFECT(0x428),
    SUMMON_CRYSTAL_ATTACK(0x429),
    SUMMON_STATE_CHANGE(0x42a),
    SPAWN_MONSTER(0x431),
    KILL_MONSTER(0x432),
    SPAWN_MONSTER_CONTROL(0x433),
    MOVE_MONSTER(0x438),
    MOVE_MONSTER_RESPONSE(0x439),
    DAMAGE_MONSTER(0x43a),
    APPLY_MONSTER_STATUS(0x43b),
    CANCEL_MONSTER_STATUS(0x43c),
    CANCEL_MONSTER_ACTION(0x43d),
    APPLY_MONSTER_STATUS_RESPONSE(0x43e),
    MONSTER_SKILL(0x443),
    SHOW_MONSTER_HP(0x446),
    SHOW_RESULTS(0x447),
    CATCH_MONSTER(0x448),
    MONSTER_SKILL_DELAY(0x44c),
    MONSTER_REQUEST_RESULT_ESCORT_INFO(0x44d),
    MONSTER_ESCORT_STOP_END_PERMMISION(0x44e),
    MONSTER_ESCORT_STOP_BY_SCRIPT(0x44f),
    MONSTER_ESCORT_STOP_SAY(0x450),
    MONSTER_ESCORT_RETURN_BEFORE(0x451),
    MONSTER_NEXT_ATTACK(0x452),
    MONSTER_TELEPORT(0x456),
    MONSTER_FORCED_ACTION(0x457),
    MONSTER_FORCED_SKILL_ACTION(0x458),
    MONSTER_LASER_CONTROL(0x46a),
    MONSTER_DEMIAN_DELAYED_ATTACK_CREATE(0x476),
    SPAWN_NPC(0x48b),
    REMOVE_NPC(0x48c),
    SPAWN_NPC_REQUEST_CONTROLLER(0x48e),
    NPC_ACTION(0x492),
    FORCE_MOVE_BY_SCRIPT(0x496),
    FORCE_FLIP_BY_SCRIPT(0x497),
    NPC_SPECIAL_ACTION(0x4a4),
    NPC_SET_SCRIPT(0x4a5),
    SPAWN_HIRED_MERCHANT(0x4a7),
    DESTROY_HIRED_MERCHANT(0x4a8),
    UPDATE_HIRED_MERCHANT(0x4a9),
    CHANGE_HIRED_MERCHANT_NAME(0x4aa),
    DROP_ITEM_FROM_MAPOBJECT(0x4ab),
    SCENE_ACTION(0x4ac),
    REMOVE_ITEM_FROM_MAP(0x4ad),
    SPAWN_LOVE(0x4af),
    REMOVE_LOVE(0x4b0),
    SPAWN_MIST(0x4b1),
    REMOVE_MIST(0x4b3),
    SPAWN_DOOR(0x4b4),
    REMOVE_DOOR(0x4b5),
    MECH_DOOR_SPAWN(0x4b9),
    MECH_DOOR_REMOVE(0x4ba),
    REACTOR_HIT(0x4bc),
    REACTOR_SPAWN(0x4be),
    REACTOR_DESTROY(0x4c2),
    SPAWN_EXTRACTOR(0x4c6),
    REMOVE_EXTRACTOR(0x4c7),
    ROLL_SNOWBALL(0x4cc),
    HIT_SNOWBALL(0x4cd),
    SNOWBALL_MESSAGE(0x4ce),
    LEFT_KNOCK_BACK(0x4cf),
    HIT_COCONUT(0x4d0),
    COCONUT_SCORE(0x4d1),
    MONSTER_CARNIVAL_START(0x4d4),
    MONSTER_CARNIVAL_OBTAINED_CP(0x4d5),
    MONSTER_CARNIVAL_STATS(0x4d6),
    MONSTER_CARNIVAL_COOLTIME(0x4d7),
    MONSTER_CARNIVAL_SUMMON(0x4d8),
    MONSTER_CARNIVAL_MESSAGE(0x4d9),
    MONSTER_CARNIVAL_DIED(0x4da),
    MONSTER_CARNIVAL_LEAVE(0x4db),
    MONSTER_CARNIVAL_RESULT(0x4dc),
    MONSTER_CARNIVAL_RANKING(0x4dd),
    ARENA_SCORE(0x4de),
    BATTLEFIELD_ENTER(0x4df),
    BATTLEFIELD_SCORE(0x4e0),
    BATTLEFIELD_TEAMCHANGED(0x4e1),
    WITCHTOWER_SCORE(0x4e2),
    BOSSSUMMON_TIMER(0x4e3),
    PVP_FIELDENTER(0x4e4),
    PVP_TEAMCHANGE(0x4e5),
    PVP_MODECHANGE(0x4e6),
    PVP_STATECHANGE(0x4e7),
    PVP_UPDATECOUNT(0x4e8),
    PVP_MODERESULT(0x4e9),
    PVP_UPDATETEAMINFO(0x4ea),
    PVP_UPDATERANKINFO(0x4eb),
    PVP_HPCHANGED(0x4ec),
    PVP_TEAMSCORE(0x4ed),
    PVP_REVIVE_MESSAGE(0x4ee),
    PVP_SCREEN_EFFECT(0x4ef),
    PVP_ICEKNIGHT_HPCHANGE(0x4f0),
    DEFENSE_WAVE(0x4f1),
    DEFENSE_LIFE(0x4f2),
    DEFENSE_POINT(0x4f3),
    DEFENSE_SCORE_RANK(0x4f4),
    DEFENSE_RESULT(0x4f5),
    RANDOM_DROP_PICKED(0x4f6),
    BROADCAST_RANDOM_DROP_PICKED(0x4f7),
    BROADCAST_RANDOM_DROP_PHASE(0x4f8),
    RANDOM_DROP_RESULT(0x4f9),
    RANDOM_DROP_POINT_EFFECT(0x4fa),
    PVPHARD_CORE_MIGRATE(0x4fb),
    PVPHARD_CORE_DEAD(0x4fc),
    PVPHARD_CORE_KILL(0x4fd),
    PVPHARD_CORE_GAUGE(0x4fe),
    PVPHARD_CORE_FIELD_INFO(0x4ff),
    PVPHARD_CORE_ENTER(0x500),
    PVPHARD_CORE_FIELD_CHANGE(0x501),
    PVPHARD_CORE_SHUTDOWN(0x502),
    PVPHARD_CORE_CHAMPION_EFFECT(0x503),
    SPAWN_RUNE(0x542),
    REMOVE_RUNE(0x543),
    RESPAWN_RUNE(0x544),
    DEMIAN_FLYING_SWORD_CREATE(0x556),
    DEMIAN_FLYING_SWORD_MAKEENTER_REQUEST(0x557),
    DEMIAN_FLYING_SWORD_MAKE_ENTER_INFO(0x558),
    DEMIAN_FLYING_SWORD_NODE(0x559),
    DEMIAN_FLYING_SWORD_TARGET(0x55a),
    DEMIAN_CORRUPTION(0x55b),
    LUCID_BUTTERFLY_ATTACK(0x560),
    LUCID_DRAGON_ATTACK(0x562),
    LUCID_FIELD_ATTACK(0x563),
    LUCID_FIELD_FLY(0x567),
    LUCID_SPECIAL_ATTACK(0x568),
    SCENE_UI(0x604),
    NPC_TALK(0x633),
    OPEN_NPC_SHOP(0x634),
    CONFIRM_SHOP_TRANSACTION(0x635),
    OPEN_STORAGE(0x64c),
    MERCH_ITEM_MSG(0x64d),
    MERCH_ITEM_STORE(0x64e),
    RPS_GAME(0x64f),
    MESSENGER(0x652),
    PLAYER_INTERACTION(0x653),
    WEDDING_PROGRESS(0x65d),
    WEDDING_CREMONY_END(0x65e),
    GHOSTPARK_FIELD_START(0x65f),
    GHOSTPARK_RUNE_USE_ACK(0x660),
    GHOSTPARK_RUNE_APPEAR(0x661),
    GHOSTPARK_RUNE_DISAPPEAR(0x662),
    GHOSTPARK_SET_KILLEDMOB_EXPRATE(0x663),
    GHOSTPARK_SET_CURSELEVEL_EXPRATE(0x664),
    GHOSTPARK_HOMING_BULLET_CREATE(0x665),
    DUEY(0x688),
    CS_UPDATE(0x68a),
    CS_OPERATION(0x68b),
    CS_UPDATE_MESO(0x68c),
    CS_COLLOCATION(0x691),
    CS_POTIONS(0x695),
    CS_POTION_POT_UPDATE(0x6a7),
    LOBBY_TIME_ACTION(0x6b1),
    SIGIN_INFO(0x6b8),
    DIMENSIONAL_MIRROR(0x6bc),
    SHOW_MAPLE_UNION(0x6be),
    MIEMIE_RANKING(0x6cb),
    SHOW_POTENTIAL_RESULT(0x6cc),
    SHOW_BULLETIN_BOARD(0x6cd),
    WORLD_RECORD_EFFECT(0x6d4),
    KEYMAP(0x6f6),
    PET_AUTO_HP(0x6f7),
    PET_AUTO_MP(0x6f8),
    PET_AUTO_BUFF(0x6f9),
    PET_AUTO_UN(0x6fa),
    GOLD_HAMMER_RESULT(0x702),
    SHOW_CHANGE_POTENTIAL_MESO(0x706),
    SHOW_CHANGE_POTENTIAL_RESULT(0x707),
    SHOW_ZERO_WEAPON_INFO(0x70a),
    SHOW_SCROLL_TIP(0x7ffe),
    START_TV(0x7ffe),
    REMOVE_TV(0x7ffe),
    ENABLE_TV(0x7ffe),
    GET_MTS_TOKENS(0x7ffe),
    MTS_OPERATION(0x7ffe),
    SPAWN_ARROWS_TURRET(0x711),
    CANCEL_ARROWS_TURRET(0x713),
    ARROWS_TURRET_ACTION(0x716),
    BATTLE_STATISTICS(0x723),
    SHOW_VISITOR_RESULT(0x727),
    UPDATE_VISITOR_KILL(0x728),
    GIANT_BOSS_MAP(0x72a),
    SHOW_PORTAL(0x72b),
    CS_HAMMER_RESPONSE(0x73b),
    PLATINUM_HAMMER(0x73e),
    DAY_OF_CHRONOSPHERE(0x73f),
    ERROR_CHRONOSPHERE(0x742),
    TAP_JOY_INFO(0x744),
    TAP_JOY_DONE(0x745),
    TAP_JOY(0x746),
    TAP_JOY_NEXT_STAGE(0x747),
    LOGIN_MESSAGE(0x759),

    PAMS_SONG(),
    SEND_PEDIGREE(),
    OPEN_FAMILY(),
    FAMILY_MESSAGE(),
    FAMILY_INVITE(),
    FAMILY_JUNIOR(),
    SENIOR_MESSAGE(),
    FAMILY(),
    REP_INCREASE(),
    FAMILY_LOGGEDIN(),
    FAMILY_BUFF(),
    FAMILY_USE_REQUEST(),
    UNKNOWN(-2);

    static {
        reloadValues();
    }

    private int code = -2;

    SendPacketOpcode() {
        this(-2);
    }

    SendPacketOpcode(int code) {
        this.code = code;
    }

    public static SendPacketOpcode getByType(int type) {
        for (SendPacketOpcode l : SendPacketOpcode.values()) {
            if (l.getValue() == type) {
                return l;
            }
        }
        return UNKNOWN;
    }

    public static Properties getDefaultProperties() throws IOException {
        Properties props = new Properties();
        FileInputStream fileInputStream = new FileInputStream("properties/sendops.properties");
        InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "GBK");
        BufferedReader buff = new BufferedReader(inputStreamReader);
        props.load(buff);
        buff.close();
        inputStreamReader.close();
        fileInputStream.close();
        return props;
    }

    public static void reloadValues() {
        try {
            File file = new File("properties/sendops.properties");
            if (file.exists()) {
                ExternalCodeTableGetter.populateValues(getDefaultProperties(), values());
            }
        } catch (IOException e) {
            throw new RuntimeException("加载 sendops.properties 文件出现错误", e);
        }
    }

    @Override
    public short getValue() {
        return (short) code;
    }

    @Override
    public void setValue(short code) {
        this.code = code;
    }
}
